
package packet.creators;

import packet.opcode.SendPacketOpcode;
import packet.transfer.write.Packet;
import packet.transfer.write.WritingDbg;

public class UIPacket {
//
//    public static final Packet EarnTitleMsg(final String msg) {
//	final Writingmaple packet = new Writingmaple();
//	packet.writeShort(SendPacketOpcode.EARN_TITLE_MSG.getValue());
//	packet.writeMapleAsciiString(msg);
//	return packet.getPacket();
//    }
    
    public static Packet showInfo(String msg) {
	final WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.TOP_MSG.getValue());
	packet.writeMapleAsciiString(msg);
	return packet.getPacket();
    }

    public static Packet getStatusMsg(int itemid) {
	WritingDbg packet = new WritingDbg();

	// Temporary transformed as a dragon, even with the skill ......
	packet.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
	packet.write(7);
	packet.writeInt(itemid);

	return packet.getPacket();
    }

   public static Packet getSPMsg(byte sp) {
	WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
	packet.write(4);
	packet.writeShort(0);
	packet.write(sp);

	return packet.getPacket();
    }

    public static Packet getGPMsg(int itemid) {
	WritingDbg packet = new WritingDbg();

	// Temporary transformed as a dragon, even with the skill ......
	packet.writeShort(SendPacketOpcode.SHOW_STATUS_INFO.getValue());
	packet.write(7);
	packet.writeInt(itemid);

	return packet.getPacket();
    }

    public static final Packet MapNameDisplay(final int mapid) {
	final WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
	packet.write(0x3);
	packet.writeMapleAsciiString("maplemap/enter/" + mapid);

	return packet.getPacket();
    }

    public static final Packet Aran_Start() {
	final WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.BOSS_ENV.getValue());
	packet.write(0x4);
	packet.writeMapleAsciiString("Aran/balloon");

	return packet.getPacket();
    }

    public static final Packet showWZEffect(final String data, int value) {
	WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
	packet.write(value == 0 ? 0x15 : 0x18);
	packet.writeMapleAsciiString(data);
	packet.writeInt(value);
	return packet.getPacket();
    }
    
    public static final Packet broadcastWZEffect(final int cid, final String data, int value) {
	WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.SHOW_FOREIGN_EFFECT.getValue());
        packet.writeInt(cid);
	packet.write(value == 0 ? 0x15 : 0x18);
	packet.writeMapleAsciiString(data);
	packet.writeInt(value);
	return packet.getPacket();
    }  
    public static final Packet showWZEffect(final String data) {
	return showWZEffect(data, 0);
    }

    public static Packet summonHelper(boolean summon) {
	WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.SUMMON_HINT.getValue());
	packet.write(summon ? 1 : 0);

	return packet.getPacket();
    }

    public static Packet summonMessage(int type) {
	WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.SUMMON_HINT_MSG.getValue());
	packet.write(1);
	packet.writeInt(type);
	packet.writeInt(7000); // probably the delay

	return packet.getPacket();
    }

    public static Packet summonMessage(String message) {
	WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.SUMMON_HINT_MSG.getValue());
	packet.write(0);
	packet.writeMapleAsciiString(message);
	packet.writeInt(200); // IDK
	packet.writeShort(0);
	packet.writeInt(10000); // Probably delay

	return packet.getPacket();
    }

    public static Packet IntroDisableUI(boolean enable) {
	WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.DISABLE_UI.getValue());
	packet.write(enable ? 1 : 0);
        if (enable) {
            packet.writeShort(1);
        }

	return packet.getPacket();
    }
    
    /*public static Packet IntroDisableUI2(boolean enable) {
	WritingDbg packet = new WritingDbg();

	packet.writeShort(SendPacketOpcode.DISABLE_UI2.getValue());
	packet.write(enable ? 1 : 0);
        if (enable) {
            packet.writeShort(1);
        }

	return packet.getPacket();
    }*/

    
    public static final Packet DublStart(boolean dark) {
	WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.SHOW_ITEM_GAIN_INCHAT.getValue());
        packet.write(0x28);
        packet.write(dark ? 1 : 0);
	return packet.getPacket();
    }
    
    public static final Packet DublStartAutoMove() {
	WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.TUTORIAL_AUTOMOVE.getValue());
        packet.write(3);
        packet.writeInt(2);
	return packet.getPacket();
    } //ACHIVEMENT_RATIO
    
    public static final Packet AchievementRatio(int value) {
	WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.ACHIVEMENT_RATIO.getValue());
        packet.writeInt(value);
	return packet.getPacket();
    }
    
    
    public static final Packet OpenUI(int value) {
	WritingDbg packet = new WritingDbg();
	packet.writeShort(SendPacketOpcode.OPEN_WINDOW.getValue());
        packet.writeLong(value);
	return packet.getPacket();
    }
    
    public static final Packet OpenPQUI(int value) {
        WritingDbg packet = new WritingDbg();
        packet.writeShort(SendPacketOpcode.OPEN_PQWINDOW.getValue());
        packet.write(value);
        return packet.getPacket();
    }
    
}
